package com.ks.common.model.response;

import lombok.Data;

import static com.ks.common.model.constant.IOConstants.RESP_FAILURE;
import static com.ks.common.model.constant.IOConstants.RESP_SUCCESS;

@Data
public class RespBaseDto<T> {

    private int code;

    private T data;

    private String message;

    public static RespBaseDto getInstance() {
        return new RespBaseDto();
    }

    public RespBaseDto success() {
        return success(null);
    }

    public RespBaseDto success(T data) {
        this.code = RESP_SUCCESS;
        this.data = data;
        return this;
    }

    public RespBaseDto fail(String message) {
        this.code = RESP_FAILURE;
        this.message = message;
        return this;
    }


}
